#!/usr/bin/env python3.3

#runs in <1sec
#answer is 233168

l=[]
for i in range(1,1000):
  if i%3==0 or i%5==0:
    l.append(i)
print(sum(l))
